package com.mi.soul.whale.mybatis.entity;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import com.mi.rule.db.entity.MiEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 用户表 实体
 * </p>
 *
 * @author 王永吉
 * @date 2020-01-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_user")
public class SysUser extends Model<SysUser> implements MiEntity {

    public static final String TABLE_NAME = "sys_user";

    private static final long serialVersionUID = 1L;


    /**
     * PK
     */
    @TableId("id")
    private String id;

    /**
     * 账号
     */
    @TableField("account")
    private String account;

    /**
     * 密码
     */
    @TableField("password")
    private String password;

    /**
     * 用户名
     */
    @TableField("name")
    private String name;

    /**
     * 手机号
     */
    @TableField("phone")
    private String phone;

    /**
     * 座机号
     */
    @TableField("telephone")
    private String telephone;

    /**
     * 盐
     */
    @TableField("salt")
    private String salt;

    /**
     * 邮箱
     */
    @TableField("email")
    private String email;

    /**
     * 身份证号
     */
    @TableField("id_card")
    private String idCard;

    /**
     * 家庭住址
     */
    @TableField("address")
    private String address;

    /**
     * 角色ID
     */
    @TableField("role_id")
    private String roleId;

    /**
     * 用户状态（1=正常，2=因为违规已停用）
     */
    @TableField("states")
    private String states;

    /**
     * 排序(默认=1)
     */
    @TableField("sort")
    private Integer sort;

    /**
     * 刷新Token
     */
    @TableField("refresh_token")
    private String refreshToken;

    /**
     * 数据创建者
     */
    @TableField(value = "create_uid", fill = FieldFill.INSERT)
    private String createUid;

    /**
     * 数据创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 数据修改者
     */
    @TableField(value = "update_uid", fill = FieldFill.INSERT_UPDATE)
    private String updateUid;

    /**
     * 数据更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 数据状态(默认=0，删除=DELETED)
     */
    @TableField("data_states")
    private String dataStates;


    /**
     * PK
     */
    public static final String ID = "id";
    public static final String ID_TF = "id";
    /**
     * 账号
     */
    public static final String ACCOUNT = "account";
    public static final String ACCOUNT_TF = "account";
    /**
     * 密码
     */
    public static final String PASSWORD = "password";
    public static final String PASSWORD_TF = "password";
    /**
     * 用户名
     */
    public static final String NAME = "name";
    public static final String NAME_TF = "name";
    /**
     * 手机号
     */
    public static final String PHONE = "phone";
    public static final String PHONE_TF = "phone";
    /**
     * 座机号
     */
    public static final String TELEPHONE = "telephone";
    public static final String TELEPHONE_TF = "telephone";
    /**
     * 盐
     */
    public static final String SALT = "salt";
    public static final String SALT_TF = "salt";
    /**
     * 邮箱
     */
    public static final String EMAIL = "email";
    public static final String EMAIL_TF = "email";
    /**
     * 身份证号
     */
    public static final String ID_CARD = "id_card";
    public static final String ID_CARD_TF = "idCard";
    /**
     * 家庭住址
     */
    public static final String ADDRESS = "address";
    public static final String ADDRESS_TF = "address";
    /**
     * 角色ID
     */
    public static final String ROLE_ID = "role_id";
    public static final String ROLE_ID_TF = "roleId";
    /**
     * 用户状态（1=正常，2=因为违规已停用）
     */
    public static final String STATES = "states";
    public static final String STATES_TF = "states";
    /**
     * 排序(默认=1)
     */
    public static final String SORT = "sort";
    public static final String SORT_TF = "sort";
    /**
     * 刷新Token
     */
    public static final String REFRESH_TOKEN = "refresh_token";
    public static final String REFRESH_TOKEN_TF = "refreshToken";
    /**
     * 数据创建者
     */
    public static final String CREATE_UID = "create_uid";
    public static final String CREATE_UID_TF = "createUid";
    /**
     * 数据创建时间
     */
    public static final String CREATE_TIME = "create_time";
    public static final String CREATE_TIME_TF = "createTime";
    /**
     * 数据修改者
     */
    public static final String UPDATE_UID = "update_uid";
    public static final String UPDATE_UID_TF = "updateUid";
    /**
     * 数据更新时间
     */
    public static final String UPDATE_TIME = "update_time";
    public static final String UPDATE_TIME_TF = "updateTime";
    /**
     * 数据状态(默认=0，删除=DELETED)
     */
    public static final String DATA_STATES = "data_states";
    public static final String DATA_STATES_TF = "dataStates";

    /**
     * 返回当前对象的JSON字符串
     */
    public String jsonStr() {
        return JSON.toJSONString(this);
    }
}
